let DateUtil = require("../../utils/dateUtil");
let Activity = function() {
    this.id = 0;
    this.title = "";
    this.priority = 0;
    this.url = "";
    this.isHot = false;
    this.startTime = 0;
    this.endTime = 0;
};

Activity.prototype.toBSON = function() {
    return {
        id : this.id,
        title : this.title,
        priority : this.priority,
        url : this.url,
        // isHot : this.isHot,
        startTime : this.startTime,
        endTime : this.endTime,
    };
};

Activity.prototype.toJSON = function () {
    return {
        id : this.id,
        title : this.title,
        priority : this.priority,
        url : this.url,
        isHot : this.isHot,
        startTime : this.startTime,
        endTime : this.endTime,
    };
};

module.exports.create = function(id, title, priority, url, isHot, startTime, endTime) {
    let activity = new Activity();
    activity.id = id;
    activity.title = title;
    activity.priority = priority;
    activity.url = url;
    activity.isHot = isHot;
    activity.startTime = startTime;
    activity.endTime = endTime;
    return activity;
};

module.exports.loadFromDocument = function (document) {
    let activity = new Activity();
    activity.id = document["id"];
    activity.title = document["title"];
    activity.priority = document["priority"];
    activity.url = document["url"];
    // activity.isHot = document["isHot"];
    activity.startTime = document["startTime"];
    activity.endTime = document["endTime"];
    return activity;
};
